﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Model
{
    public static class ComponentFactory
    {
        public static T Create<T>(Entity entity) where T : Component
        {
            var comp = Activator.CreateInstance<T>();
            comp.Entity = entity;
            ObjectEvents.Instance.Awake(comp);
            return comp;
        }

        public static T Create<T, A>(Entity entity, A a) where T :Component 
        {
            var comp = Activator.CreateInstance<T>();
            comp.Entity = entity;
            ObjectEvents.Instance.Awake<A>(comp,a);
            return comp;
        }

        public static T Create<T, A,B>(Entity entity, A a,B b) where T : Component
        {
            var comp = Activator.CreateInstance<T>();
            comp.Entity = entity;
            ObjectEvents.Instance.Awake<A, B>(comp, a, b);
            return comp;
        }
    }
}
